home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
1810
/
1810.xpi
/
chrome
/
showcase.jar
/
content
/
settings
/
pref-shortcuts.js
< prev
next >
Wrap
Text File
|
2010-01-17
|
2KB
|
57 lines
function shortcutsPrefInit() {
var extensionManager;
var keyconfigExtension;
var shortcutsPanelDeck = document.getElementById("shortcutsPanelDeck");
extensionManager = Components.classes["@mozilla.org/extensions/manager;1"]
.getService(Components.interfaces.nsIExtensionManager);
keyconfigExtension = extensionManager.getItemForID("keyconfig@dorando");
// If it fails, try with old id
if ((!keyconfigExtension) || (keyconfigExtension.type == 0)) {
keyconfigExtension = extensionManager.getItemForID("{c8500d90-d72d-11d9-8cd5-0800200c9a66}");
}
if ((!keyconfigExtension) || (keyconfigExtension.type == 0)) {
shortcutsPanelDeck.setAttribute("selectedIndex", 0);
} else {
var xmlDoc = document.implementation.createDocument("", "keyconfig", null);
xmlDoc.async = false;
try {
xmlDoc.load("chrome://keyconfig/content/");
if (xmlDoc.documentElement) {
// Enabled
shortcutsPanelDeck.setAttribute("selectedIndex", 2);
} else {
// Disabled
shortcutsPanelDeck.setAttribute("selectedIndex", 1);
}
} catch (e) {
// Exception while loading, so it's disabled
shortcutsPanelDeck.setAttribute("selectedIndex", 1);
}
}
}
function callKeyConfig(createWindowIfNecessary) {
// Target all windows
var wm = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator);
var windowIter = wm.getEnumerator('navigator:browser');
var keyconfigInvoked = false;
while (windowIter.hasMoreElements() && !keyconfigInvoked) {
var currentWindow = windowIter.getNext();
try {
currentWindow.openDialog('chrome://keyconfig/content/', 'keyconfig', 'resizable');
keyconfigInvoked = true;
} catch (e) { }
}
if (!keyconfigInvoked && createWindowIfNecessary) {
openURL();
setTimeout(callKeyConfig, 0, false);
}
}